package com.example.shop.util;

/**
 * @BelongsProject: boot
 * @BelongsPackage: com.leisure.boot.util
 * @Author: 硕哥
 * @CreateTime: 2022-11-07  15:01
 * @Description: TODO
 * @Version: 1.0
 */

public class ResultCode {

    private int code;

    private String msg;

    public static  final ResultCode SUCCESS = dealResult(ResultCodeEnum.SUCCESS);

    public static  final ResultCode ERROR = dealResult(ResultCodeEnum.ERROR);

    public static  final ResultCode TIMEOUT = dealResult(ResultCodeEnum.NETWORK_TIMEOUT);

    public static  final ResultCode FILE_TYPE_ERROR = dealResult(ResultCodeEnum.FILE_TYPE_ERROR);
    public static  final ResultCode FILE_OUT_MAX = dealResult(ResultCodeEnum.FILE_OUT_MAX);




    private static ResultCode dealResult(ResultCodeEnum codeEnum){
        return new ResultCode(codeEnum.getCode(),codeEnum.getMsg());
    }

    public ResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
